<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>填写订单信息 - 爽客网</title>
<%@include file="../common/js.jsp" %>
<%@include file="../common/css.jsp" %>
<link href="css/detail.css" type="text/css" rel="stylesheet" />
</head>
<body>
<%@include file="../common/header.jsp" %>
<div class="wrap">
    	<div class="w980 mg mt20 mb20 book_hotel">
            <div <c:if test="${hotel.payFrom=='01' }">class="order_tip"</c:if><c:if test="${hotel.payFrom=='02' }">class="no_pay_fill"</c:if> ></div>
            <div class="f_order_title">
            	<span class="fl">预订：</span><i class="fl">${hotel.name}（${room.name }）</i>
            </div>
            <!-- content -->
            <form action="bookRoom.htm" method="post" id="order_form">
            <input type="hidden" name="rid" value="${room.id}"/>
            <input type="hidden" name="udate" value="${udate}"/>
            <input type="hidden" name="orderTime" value="${udate}"/>
            <input type="hidden" name="ldate" value="${ldate}"/>
            <div class="f_detail_box">
            	<!-- pro-info-->
            	<div class="f_pro_box">
                	<h1><i class="f_orderbg"></i>产品信息</h1>
                    <table class="hotel_list dis1">
                    	<thead>
                        	<th width="115" class="col_s1">入住日期</th>
                            <th width="115" class="col_s1">离开日期</th>
                            <th width="115" class="col_s1">入住晚数</th>
                            <th width="130" >入住房型</th>
                            <th width="96">市场价</th>
                            <th width="86">现售价</th>
                            <th width="130">数量(间/晚)</th>
                            <th width="120">小计</th>
                        </thead>
                    	<tbody>
                        	<tr>
                            	<td class="col_s1"><span>${udate}</span></td>
                                <td class="col_s1">${ldate}</td>
                                <td class="col_s1">${day }晚</td>
                                <td class="col_s2"><a href="hotel.htm?id=${hotel.id }" class=" clrblue">${room.name }</a></td>
                                <td class="col_s2"><span class="farial lt">¥${room.priceMarket}</span></td>
                                <td class="col_s2"><span class="farial clrf60 fb">¥${roomPrice.priceA }</span></td>
                                <td>
                                	<div class="nums_wrap">
                                        <a href="javascript:void(0)" class="f_orderbg minus" onclick="minusOne();"></a>
                                        <input type="text" value="${count }" name="count" id="rnums" readonly="readonly"/>
                                        <a href="javascript:void(0)" class="f_orderbg add" onclick="addOne();"></a>
                                    </div>
                                </td>
                                <td class="col_s2"><span class="farial clrf60 fb">¥<i id="totalM">${roomPrice.priceA * count*day}</i></span></td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="dis1 instruc_wrap">
                    	<ul class="f_instruc clearfix">
                        	<li class="current">
                        		费用说明
                            </li>
                            <%--<li>
                            	退款说明
                            </li>
                        --%></ul>
	                       <div class="content">
	                        	${room.desc}
	                        </div>
                    </div>
                </div>
                <!-- pro-info--end -->
                <!-- ticketer-info -->
                <div class="f_pro_box">
                	<h1><i class="f_orderbg"></i>入住人信息<span class="clrc06">（请准确填写入住人信息，我们将向入住人手机发送订单短信）</span></h1>
                    <ul class="input_info dis1">
                    	<li>
                        	<label><i class="alarm">*</i>入住人姓名：</label>
                            <input type="text" id="contactor" name="contactor"/>
                        </li>
                        <li>
                        	<label><i class="alarm">*</i>入住人手机：</label>
                            <input type="text" name="phone" id="phone"/>
                            <span class="mt10 ml10"> （免费接收短信，作为入住凭证，请准确填写）</span>
                        </li>
                    </ul>
                </div>
                <!-- ticketer-info--end -->
                <!-- orderbak -->
                <div class="f_pro_box">
                	<h1><i class="f_orderbg"></i>订单备注</h1>
                    <ul class="input_info dis1 remark">
                    	<li>
                        	<label>订单备注：</label>
                            <textarea rows="4" cols="70" name="memo" id="memo"></textarea>
                        </li>
                    </ul>
                </div>
                <!-- orderbak--end -->
                <div class="f_price_wrap">
                	<span>产品金额：</span><em>¥${roomPrice.priceA * count}</em> 应付：<span class="f_pay_price"><em>¥</em><i id="totalOrder">${roomPrice.priceA * count*day}</i></span>
                </div>
                <div class="f-order_commit">
                	<input type="button"  value="确认下单" class="f_orderbg f_btn_sub" id="order_bt"/>
                    <input type="checkbox" class=" cb_style" checked="checked" name="coolprotocol" id="coolprotocol"/><label class="clrblue" for="coolprotocol">同意爽客网票务预订协议</label>
                </div>
            </div>
            </form>
            <!-- content--end-->
        </div>
    </div>
    <script type="text/javascript">
    	$(function(){
    		$("#order_bt").click(function(){
    			var contactor = $("#contactor").val();
	    		if(IsNull(contactor)){
	    			alert("请输入联系人");
	    			return ;
	    		}
	    		var phone = $("#phone").val();
	    		if(GGTOOL.mobileCheck(document.getElementById("phone"))){
	    			if(COOL.checkLogin()){
	    				$("#order_form").submit();
	    			}else{
	    				COOL.memberLogin();
	    			}
	    			
	    		}
    		});
    	});
    	
    	function minusOne(){
    		var obj=$("#rnums");
    		var m=parseFloat($("#totalM").val());
    		var n=parseInt(obj.val());
    		if(n-1>0){
    			obj.val(n-1);
    			var p=parseFloat("${roomPrice.priceA *day}")*(n-1);
				$("#totalOrder").html(p);
				$("#totalM").html(p);
    		}else{
    			alert("最小起订量为1");	
    		}
    		
    	}
    	
    	function addOne(){
    		var obj=$("#rnums");
    		var n=parseInt(obj.val());
    		$.post("roomNum.htm",{roomId:"${room.id}"},function(num){
    			if(num<n+1){
    				alert("最大定量为"+n)
    			}else{
    				obj.val(n+1);
    				var p=parseFloat("${roomPrice.priceA *day}")*(n+1);
    				$("#totalOrder").html(p);
    				$("#totalM").html(p);
    			}
    		});
    		
    	}
    </script>
</body>
</html>
